const remUnit = 100
const defaultWidth = 375

const setHtmlPx = () => {
  const innerWidth = window.innerWidth
  const newSize = innerWidth / defaultWidth * remUnit / 2
  document.querySelector('html').style.fontSize = newSize + 'px'
}
setHtmlPx()

window.addEventListener('resize', () => {
  setHtmlPx()
})
